package com.blog.service.Impl;

import com.blog.dao.BlogTagMapper;
import com.blog.pojo.BlogTag;
import com.blog.service.BlogTagService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Copyright (C), 2022
 * Author: 苏大大
 * Date: 2022-06-14 14:21
 * FileName: BlogTagServiceImpl
 * Description: 博客标签业务层
 */
@Service
public class BlogTagServiceImpl implements BlogTagService {

    @Resource
    private BlogTagMapper mapper;
    @Override
    public void insertBlogTags(int[] tag,Long blogId) {
        for (int i=0;i<tag.length;i++){
            BlogTag blogTag=new BlogTag();
            blogTag.setBlogId(blogId);
            blogTag.setTagId(tag[i]);
            mapper.insertBlogTag(blogTag);
        }
    }

    @Override
    public void delByBlogId(Long blogId) {
        mapper.delByBlogId(blogId);
    }
}
